UserPortlet = Class.extend({
	init: function()	{
		this.name = "UserPortlet";
	},
	
	onReloadPage: function()	{
		this.run();
	},
	
	run: function()	{
		//store the current object
		var obj = this;
		var id = this.getRequest().getParam('id');
		this.onAjax('user', 'view-info', {id: id}, 'GET', {
			'onSuccess': function(ret)	{
				obj.model = ret;
				if (ret.gender == 0)
					obj.model.gender = "Nữ";
				else
					obj.model.gender = "Nam";
				var d = ret.dob_day;
				var m = ret.dob_month;
				var y = ret.dob_year;
				var dob = undefined;
				if (d != undefined && m != undefined && y != undefined)	{
					dob = d+'/'+m+'/'+y;
				} else if (m != undefined && y != undefined)	{
					dob = m+'/'+y;
				} else if (d != undefined && m != undefined)	{
					dob = d+'/'+m;
				}
				obj.model.dateofbirth = dob;
				obj.getPortletPlaceholder().paintCanvas(obj.render());
			}
		});
	}
}).implement(PortletInterface).implement(RenderInterface).implement(AjaxInterface);